package com.cl.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.AvoidXfermode.Mode;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;


public class BootCompleteReceiver extends BroadcastReceiver{
	private static final String TAG = "BootCompleteReceiver";
	private SharedPreferences sp;
	private TelephonyManager tm;
	@Override
	public void onReceive(Context context, Intent intent) {
		sp = context.getSharedPreferences("isGuidered", context.MODE_PRIVATE);
		boolean isGuidered = sp.getBoolean("isGuidered", false);
		if(isGuidered) {//做过向导指南
			tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
			//真实的手机序列
			String realSimSeria = tm.getSimSerialNumber();
			Log.i(TAG, "真实的手机序列"+realSimSeria);
			//获得绑定状态
			String simSeria = sp.getString("simSeria", "");
			if(realSimSeria.equals(simSeria)) {
				//SIM卡序列一样
				Log.i(TAG, "SIM卡序列一样");
			}else{
				Toast.makeText(context, "SIM卡被更改了", 0).show();
				Log.i(TAG, "SIM卡序列不一样，需向安全号码偷偷发送消息");
			}
		}
		
	}
	
}
